import http from "../../http"
import type { RoleSaveReq, RolePageQuery } from "./RoleModel"

export class RoleApi {
    static newAdd(saveReq: RoleSaveReq) {
        return http.post('/role', saveReq)
    }

    static page(query: RolePageQuery) {
        return http.get('/role/page', query)
    }

    static delete(roleId: string | number) {
        return http.delete(`/role/${roleId}`)
    }

    static edit(saveReq: RoleSaveReq) {
        return http.put('/role', saveReq)
    }

    static listRoleOption() {
        return http.get('/role/list-role-option')
    }

    static assignMenu(roleId: string | number, menuList: any[]) {
        return http.post('/role/assign-menu', { roleId, menuList })
    }

}